<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>视口居中</title>
    <link rel="stylesheet" href="../../css/reset.css">
</head>
<style>
    .box1{
        width: 600px;
        height: 400px;
        border: 1px solid black;
        position: fixed;
        margin:auto auto;
        left: 0;
        right: 0;
        top: 0;
        bottom: 0;
        background-color: #777777;
    }
    .box2{
        height: 10000px;
        background-color: aqua;
    }
</style>
<body>
<div class="box2">

</div>
<div class="box1">

</div>
</body>
</html>